let mut ret = Vec::new();
match *unit.target.kind() {
- TargetKind::Example | TargetKind::Bin | TargetKind::CustomBuild |
- TargetKind::Bench | TargetKind::Test => {
+ TargetKind::Example |
+ TargetKind::Bin |
+ TargetKind::CustomBuild |
+ TargetKind::Bench |
+ TargetKind::Test => {
ret.push(format!("{}{}", stem, suffix));
}
TargetKind::Lib(..) if unit.profile.test => {
ret.push(format!("{}{}", stem, suffix));
}
TargetKind::Lib(ref libs) => {
- for lib in libs.iter() {
+ for lib in libs {
match *lib {
LibKind::Dylib => {
- match self.dylib(unit.kind) {
- Ok((prefix, suffix)) =>
- ret.push(format!("{}{}{}", prefix, stem, suffix)),
- Err(e) => try!(self.config.shell().warn(format!("{}", e)))
+ if let Ok((prefix, suffix)) = self.dylib(unit.kind) {
+ ret.push(format!("{}{}{}", prefix, stem, suffix));
}
}
LibKind::Lib |
}
}
}
+ if ret.is_empty() {
+ if libs.contains(&LibKind::Dylib) {
+ bail!("cannot produce dylib for `{}` as the target `{}` \
+ does not support dynamic libraries",
+ unit.pkg, self.target_triple)
+ }
+ bail!("cannot compile `{}` as the target `{}` does not \
+ support any of the output crate types",
+ unit.pkg, self.target_triple);
+ }
}
}
- if ret.is_empty() {
- bail!("no valid targets found")
- }
Ok(ret)
}